package com.woniu.userassembly.model;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

@Configuration
public class AlipayConfig {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016110300790080";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCtyqrHk4N6GFDR/zuLQ1UjVpK6yIo49McjdMZxjxUa5ig8ZB40Wv+vJy5cE8xKbMiOCh6FctJmVDR40gpKJms3isuhePavawIoWc8S6+JIw1qp8uARcKcZV6hkC/OcooR8cpfsh1XwWEFgujSWxxguE+omq9/f4G2KxFZeoBRKD2c2zFOMQBT8vqTW3hAPyfvlHWvjEp3/dUR6Fx1/pFggvngOMxWj5nDMlD43ZrypvA8KEjID4/cMPaHP+AJo7mdwbJ7YET+/pmA8Vh5/GwfAlOaTPqwyalGIm+XPbiyYoPuHa6lWKfWcick67LiubzDys6+aKbWU5lVze3p9hTrVAgMBAAECggEAIIsCz7xfsk07VRdmHv3Mw4FCmJdUyrWLVKhZQIp6eT7/6c8VmNgxaKr9k2BhsM4OAAsFDBgkLeU2rikmpBvtl8j1uJbeGpr/HG80x2ZESTvLjmdcbeeaYrR3Y8SZKYuFI4iRykjNXuQn2eUEU/eUH4y7G+KzWUi9Om7pfW6cXgGU/P6/6uAXuyducOOW3FrXtS5PvcaTz1szl+4xHSt7taeQ00TeA0Gg4T7WckgzjUqchiOhEygIFO11jG/VfbK4Fl0JOHCCuFF02E3dtjUnyMPGcon+yRnQgmMRXkqi783vTEQlSlNuSbP6y5AvO2v8fP9MMLJRF8ZAtW1GOolaAQKBgQDpQzzql1UJNbhPWRjzij7uh6dlaNqbc18lMRGTxoXXRNsRZpIfx4n5+A/GnM0wAOlj0bgz/17Zab25FaLQho9JLqmLlDMEb/o9Bbx5B4Jibv2KXYB5W/H+zdWbeETxkG1a7WNHE9yWveTseu9J8Lb0BWo7n2S0ls4H4M+ZEDlnyQKBgQC+u2jB3zkX5GnuLvVYmd4TX1aMZmUJGUp2VVV0H/2b3tLpRAwSuqh6G52sUN2EM1/7TwtoA6mYhlj5Nbby2oYMYLIP0C5v3MTlQzoQMBwxNfssWXJn16AswmBpr7Fh3XYQ3mIiioxF5ZsW1cokEZhdcuHLF9an//G+JJHv8yVYrQKBgFzjq7R3wyNBwz3F60vAd8MhPiYCFVvmG7OB0NAaNF4/S0WopPQG0Ak9IXskIgnFsytO7p22Sh0mIKk91nJXw2OPM3Ej+RUBSpNWX3GK7f8o18pr5aduV/XyHeglgr73lrSo5+n8HNHimPEbG4NEWnbeWSmZFc9cZnt4qPL5JQMRAoGBALSWNuqRErqXbuCwn2YDUWvgMc7/SBxkUMdXpnArtfC1+dYYsqGtD8WFjjVP31zDU9ZbEf6qsRIT6fwTKqQn2RGxIAau4rjRO6+ihkA7fQXvCWEFU7gURbj7VVPboMR7bcUs+ZegvI2VhtEJHLon2q5oDnc/m+M3B0kz0OVyvuKFAoGAIzX3X+lGlPuC4714zrjO7xYAzO+uZfFgc4wH/+NmLuzfbhueDogZEgG5H23qkC5THwKOpmUxS5EB5myc9yAJTVD5xPMddnnRv3ze/uSrMceyN29LjXUE6m91sf4uWRwry1Z+K08EycRk94/l9+zrlYsrz6iW9v9zqE2NViiHbvc=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAng/DPC5RRgoXfpt5zT5asC9Xo0JYAxfTg+9qFtLI2vUDWlgwuJqzoA+uUB70DHQidPVzJd2kPPD9EUN2NpqD3+SBi8Y3w7Fku18NicnVzdiI6mJd1Csb7HNBMpwZOjaeYx+0fTgoi0Zk2YUNDR41T1RxdSgKaBUqHLXl4upeGi/EgU9NJrg4tJ/bWDTKcg8UXRu742fO67ECItpl2E3vqQMVXtBBml/dSEltkS3R9nNVi9+WJCOCgYCISDWK1zeHsi8YXHGJPvLGcUOI0lsHLvqucL6uYtdyJCt+2WO+bitYLqYduzW75B0oAAF8MwN6CykrstLOFx8zU6MFmgbUMQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    // 向后端发送异步回调，确认支付成功（执行其他请求）
    public static String notify_url = "http://359r203q30.wicp.vip/testInDemo";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    // 前端直接跳转网页（给用户看）
    public static String return_url = "http://359r203q30.wicp.vip/testDemo";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "https://openapi.alipaydev.com/gateway.do";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
